<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title language="html:addSliderPage"></title>
    <link rel="stylesheet" type="text/css" href="/static/common/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="/static/common/easyui/themes/bootstrap/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/common/easyui/themes/IconExtension.css">
    <link rel="stylesheet" href="/static/common/pnotify/pnotify.custom.min.css" media="all" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/admin.css">
    <link rel="stylesheet" href="/static/common/animate/animate.min.css">
    <link rel="stylesheet" href="/static/common/fileupload/jquery.fileupload.css">
</head>
<body>
    <form action="/intendant/enterprise/addSliderSubmit">
        <div class="frame_form_table">
            <table cellpadding="0" cellspacing="0" class="table_form" width="100%">
                <tbody>
                    <tr>
                        <td width="40" language="table:enterpriseSliderName"></td>
                        <td width="190"><input class="easyui-textbox length_6" type="text" name="name" data-options="required:true"></td>
                    </tr>
                    <tr>
                        <td width="40" language="table:enterpriseSliderUrl"></td>
                        <td width="190"><input class="easyui-textbox length_6" type="text" name="url" data-options="required:true"></td>
                    </tr>
                    <tr>
                        <td width="40" language="table:enterpriseSliderSort"></td>
                        <td width="190"><input class="easyui-textbox length_6" type="text" name="sort" data-options="required:true"></td>
                    </tr>
                    <tr>
                        <td width="40" language="table:enterpriseSliderImage"></td>
                        <td>
                            <div class="hm_fileupload">
                                <button type="button" class="fileinput-button"><span language="html:uploadImage">上传图片</span><input id="fileupload" type="file" name="uploadImage"></button>
                                <div class="imgbutton">
                                    <img id="uploadimg" src="/static/admin/img/uploadFail.jpg" width="600px" height="400px"/>
                                    <input type="hidden" name="image" value="" />
                                </div>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div id="hm_toolbar">
            <a onclick="javascript:history.back(-1);" class="easyui-linkbutton" iconCls="icon-arrow_turn_left" plain="true" language="html:goback"></a>
            <a id="btn" href="" class="easyui-linkbutton" iconCls="icon-arrow_refresh" plain="true" language="html:refreshCurrent"></a>
            <a id="btn" href="javascript:void(0)" onclick="hm.ajaxAddEdit(addSliderFunc,this)" class="easyui-linkbutton" iconCls="icon-add" plain="true" language="html:ajaxAdd"></a>
        </div>
    </form>
</body>
<script type="text/javascript" src="/static/common/easyui/jquery.min.js"></script>
<script type="text/javascript" src="/static/common/easyui/jquery.cookie.js"></script>
<script type="text/javascript" src="/static/common/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/static/common/pnotify/pnotify.custom.min.js"></script>
<script type="text/javascript" src="/static/common/fileupload/jquery.ui.widget.js"></script>
<script type="text/javascript" src="/static/common/fileupload/load-image.all.min.js"></script>
<script type="text/javascript" src="/static/common/fileupload/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="/static/common/fileupload/jquery.fileupload.js"></script>
<script type="text/javascript" src="/static/common/fileupload/jquery.fileupload-process.js"></script>
<script type="text/javascript" src="/static/common/fileupload/jquery.fileupload-image.js"></script>
<script type="text/javascript" src="/static/admin/js/language.js"></script>
<script type="text/javascript" src="/static/admin/js/global.js"></script>
<script type="text/javascript">
 $('#fileupload').fileupload({
    type: 'POST',
    url: '/intendant/site/uploadImage',
    dataType: 'json',
    // formData: {id: 123},
    autoUpload: true,
    acceptFileTypes: /^image\/(gif|jpeg|png)$/,
    maxFileSize: 200,
    done: function (e, data) {
        $('#uploadimg').attr('src','/static/upload/images/'+data.result.info);
        $('input[name="image"]').val(data.result.info);
        hm.notice("success", hm.language.uploadSuccess);
    },
    fail: function (e,data) {
        $('#uploadimg').attr('src','/static/admin/img/uploadFail.jpg');
        hm.notice("error", hm.language.uploadFail);
    },
    disableImageResize: /Android(?!.*Chrome)|Opera/
        .test(window.navigator && navigator.userAgent),
    imageMaxWidth: 1200,
    imageMaxHeight: 800,
    imageCrop: true // Force cropped images
});
function addSliderFunc(data){
    if (data.status == 66) {
        parent.hm.notice("error", hm.language.noAuth);
    } else if(data.status == 11){
        parent.hm.notice("warn", data.info);
    } else if(data.status == 12){
        parent.hm.notice("warn", data.info);
    } else if(data.status == 4){
        parent.hm.notice("error", hm.language.addFailed + data.info);
    } else if(data.status == 1){
        parent.hm.notice("success", hm.language.addSuccess);
        parent.hm.refreshTab();
    }else{
        parent.hm.notice("error",hm.language.unknownError);
    }
}
</script>
</html>
